package On_class.L0414;

import java.sql.*;

public class Mysql {
    public static void main(String[] args) throws Exception {
        String url="jdbc:mysql://localhost:3306/jdbc?serverTimezone=GMT%2B8";
        String user="root";
        String password="2001hong";
        Connection conn = DriverManager.getConnection(url,user,password);
        String sql="insert into user(name) values('Tom')";

        Statement stmt=conn.createStatement();
        int i=stmt.executeUpdate(sql);
        if(i>0){
            System.out.println("添加成功");
        }else{
            System.out.println("添加失败");
        }
        stmt.close();
        conn.close();
    }
}
